﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ErrorPageZ.Classes;

namespace ErrorPageZ.Controllers
{
    public class StatusCodesController
    {
        public static List<StatusCodeInfo> StatusCodes()
        {
            List<StatusCodeInfo> codes = new List<StatusCodeInfo>();

            StatusCodeInfo info403 = new StatusCodeInfo(403, "Forbidden", "Forbidden indicates that the server refuses to fulfill the request");
            CustomErrorPageInfo errorInfo403 = CustomErrorPagesController.GetCustomErrorPage(403);
            if (errorInfo403 != null)
            {
                info403.Set = errorInfo403.PageId != 0 ? true : false;
                info403.PageId = errorInfo403.PageId;
                info403.redirect = errorInfo403.redirect;
            }
            codes.Add(info403);

            StatusCodeInfo info404 = new StatusCodeInfo(404, "NotFound", "NotFound indicates that the requested resource does not exist on the server");
            CustomErrorPageInfo errorInfo404 = CustomErrorPagesController.GetCustomErrorPage(404);
            if (errorInfo404 != null)
            {
                info404.Set = errorInfo404.PageId != 0 ? true : false;
                info404.PageId = errorInfo404.PageId;
                info404.redirect = errorInfo404.redirect;
            }
            codes.Add(info404);

            return codes;
        }
    }
}
